import { Prefab, resources } from "cc";
import { Ab_GameHint_bA } from "./float.game.hint";

export enum Ab_EGameFloat_bA {
	Ab_HINT_bA,
}

const Ab_Config_bA = {
	[Ab_EGameFloat_bA.Ab_HINT_bA]: {
		component: Ab_GameHint_bA,
		path: 'prefab-game/float/hint',
		script: './float.game.hint',
		prefab: null,
	}
}

export async function Ab_GetGameFloatPrefab_bA(p: Ab_EGameFloat_bA): Promise<Prefab> {
	let conf = Ab_Config_bA[p];
	if(!conf.prefab){
		conf.prefab = await abi.Ab_cc_bA.Ab_loadResAsync_bA(conf.path, Prefab, resources);
	}

	return conf.prefab;
}

export async function Ab_GetGameFloatComponent_bA<F extends Ab_EGameFloat_bA>(p: F): Promise<(typeof Ab_Config_bA)[F]['component']> {
	let conf = Ab_Config_bA[p];
	if(!conf.component){
		conf.component = await import(conf.script).then(m=>m.default);
	}

	return conf.component;
}

export type Ab_GameFloatCtor_bA<F extends Ab_EGameFloat_bA> = typeof Ab_Config_bA[F]['component'];

export type Ab_GameFloatIns_bA<F extends Ab_EGameFloat_bA> = InstanceType<Ab_GameFloatCtor_bA<F>>;
